class Dog {
  name: string;
  age: number;
  constructor(name: string, age: number) {
    // console.log("构造函数执行了");
    // 在实例方法中，this指向当前的实例
    this.name = name;
    this.age = age;
  }
  bark() {
    // 在方法中可以通过this来表示当前调用方法的对象
    console.log("汪汪汪");
  }
}

const dog1 = new Dog('旺财', 3);
const dog2 = new Dog('小黑',4);
const dog3 = new Dog('小白',4);

console.log(dog1);
console.log(dog2);
console.log(dog3);
